package com.github_dididipapa.mall.product.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github_dididipapa.mall.product.entity.AttrEntity;
import com.github_dididipapa.mall.product.entity.AttrGroupEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 属性分组
 * 
 * @author dididipapa
 * @email not_found@404.com
 * @date 2025-04-26 18:14:11
 */
@Mapper
public interface AttrGroupDao extends BaseMapper<AttrGroupEntity> {

    @Select("select * from pms_attr_group where catelog_id = #{cateLogId}")
    List<AttrGroupEntity> getAttrGroup(Long cateLogId);

    @Select("select * \n" +
            "from pms_attr_group as g\n" +
            "join pms_attr_attrgroup_relation as r on g.attr_group_id = r.attr_group_id\n" +
            "join pms_attr as a on r.attr_id = a.attr_id\n" +
            "where g.catelog_id = #{catelogId}")
    List<AttrEntity> getRelationAttr(Long catelogId);




    void updateCategory(@Param("groupId")Long attrGroupId, @Param("catId") Long catelogId);
}
